home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / dev / basic / ace24dist.lha / ace24.lha / SUBmods / Complex / mandel.b < prev    next >
Text File  |  1996-09-10  |  726b  |  49 lines

  1. #include <SUBmods/complex.h>
  2.  
  3. DECLARE STRUCT Complex a,b,c,t,*d
  4.  
  5. window 1,,(0,0)-(400,400),16
  6.  
  7. on break goto quit
  8.  
  9. right  =   .75
  10. left   = -2.25
  11. top    =  1.5
  12. bottom = -1.5
  13.  
  14. depth = 50
  15.  
  16. dx = (right-left)/400
  17. dy = (bottom-top)/400
  18.  
  19. break on
  20.  
  21. for y = 1 to 400
  22.   b->imag = top + y*dy
  23.   for x = 1 to 400
  24.     b->real = left + x*dx
  25.  
  26.     a->real = 0 : a->imag = 0
  27.     r! = 0 : ctr = 0
  28.  
  29.     while r! < 100 and ctr < depth
  30.       MulComp(a,a,c)
  31.       AddComp(c,b,a)
  32.       r! = (a->real * a->real) + (a->imag * a->imag)
  33.       ++ctr
  34.     wend
  35.  
  36.     color 1
  37.     if ctr < depth then color 2
  38.     if ctr< depth and abs(a->real) > 5 and abs(a->imag) > 5 then color 3
  39.     pset (x,y)
  40.   next
  41. next
  42.  
  43. locate 0,0
  44. input a$
  45.  
  46. quit:
  47.   window close 1
  48.   end
  49.